#include "signaltest.h"

int PutStr(char* fmt,...)
{
	va_list al;
	char buf[512];

	memset(buf,0,sizeof(buf));
	va_start(al,fmt);
	vsprintf(buf,fmt,al);
	va_end(al);
	
	return 0;
}
void get_time()
{
	struct tm *ostime;
	time_t tt;

	time(&tt);
	ostime = localtime(&tt);
	
	printf("%d%02d%02d\n",ostime->tm_year+1900,ostime->tm_mon+1,ostime->tm_mday);
}
void SignalFun(int signalnum)
{
	switch(signalnum){
		case 2:
			printf("SIGINT");
			break;
		case 4:
			printf("SIGILL");
			break;
		case 8:
			printf("SIGFPE");
			break;
		case 11:
			printf("SIGSEGV");
			break;
		case 15:
			printf("SIGTERM");
			break;
		case 21:
			printf("SIGBREAK");
			break;
		case 22:
			printf("SIGABRT");
			break;
	}
}

int main(int argc,char** argv)
{
	signal(SIGINT,SignalFun);
	signal(SIGABRT,SignalFun);
	signal(SIGTERM,SignalFun);

	get_time();
// 	for (;;)
// 	{
// 	}
	system("pause");
	return 0;
}